package hk.m4s.lr.repair.test.ui.user;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

import framework.common.baseui.UeBaseActivity;
import hk.m4s.lr.repair.test.R;
import lsp.com.lib.PasswordInputEdt;

public class SetPayPassActivity extends UeBaseActivity implements OnClickListener{
	private PasswordInputEdt pwdText1,pwdText2;
	private TextView nextText,title;
	private ImageButton back;
	private String pwd1="",pwd2="";
	private Context context;
     @Override
    protected void onCreate(Bundle savedInstanceState) {
    	// TODO Auto-generated method stub
    	super.onCreate(savedInstanceState);
    	context=this;
    	baseSetContentView(R.layout.activity_set_pay_pass);
		 showGoBackBtn();
		 setTitleText("密码设置");
		 hiddenFooter();
    	pwdText1=(PasswordInputEdt)findViewById(R.id.ppe_pwd);
    	pwdText2=(PasswordInputEdt)findViewById(R.id.ppe_pwd2);
    	title=(TextView)findViewById(R.id.title);
    	if(getIntent().getStringExtra("title")!=null){
    		title.setText(getIntent().getStringExtra("title"));
    	}
		 pwdText1.setRectNormalColor(Color.parseColor("#cccccc"));
		 pwdText1.setRectChooseColor(Color.parseColor("#cccccc"));
		 pwdText2.setRectNormalColor(Color.parseColor("#cccccc"));
		 pwdText2.setRectChooseColor(Color.parseColor("#cccccc"));
		 pwdText1.setOnInputOverListener(new PasswordInputEdt.onInputOverListener() {
			 @Override
			 public void onInputOver(String text) {
				 pwd1=text;
			 }
		 });
		 pwdText2.setOnInputOverListener(new PasswordInputEdt.onInputOverListener() {
			 @Override
			 public void onInputOver(String text) {
				 pwd2=text;
			 }
		 });
    	nextText=(TextView)findViewById(R.id.home_next_order);

    	nextText.setOnClickListener(this);

    }
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.home_next_order:
			if(pwd1.equals("")){
				Toast.makeText(context,"请输入密码",Toast.LENGTH_SHORT).show();
				return;
			}else if(pwd2.equals("")){
				Toast.makeText(context,"请输入密码",Toast.LENGTH_SHORT).show();
				return;
			}
			  if(pwd1.equals(pwd2)){
				  Intent in=new Intent(SetPayPassActivity.this,SetPayQuestionActivity.class);
				  in.putExtra("pwd1",pwd1);
				  in.putExtra("pwd2",pwd2);
				  startActivity(in);
				  finish();
			  }else{
				  Toast.makeText(context,"两次密码不一致", Toast.LENGTH_SHORT).show();
			  }
			break;
		default:
			break;
		}
	}
}
